15. AndroidX Test

L5 P2 A04 AndroidX Test V2

About the Robolectric Errors

Error 1: No such manifest file: ./AndroidManifest.xml

You can fix the No such manifest file: ./AndroidManifest.xml error, by updating your gradle file.

  1. Add the following line in your gradle to so that the correct android manifest is used:

app/build.gradle

    // Always show the result of every unit test when running via command line, even if it passes.
    testOptions.unitTests {
        includeAndroidResources = true

        // ... 
    }

The includeAndroidResources option allows you to access android resources in your unit tests, including your AndroidManifest file.

Error 2: Android SDK 10000

The warning about the Android SDK 10000 is more complicated - running tests on Android Q requires Java 9. Instead of trying to configure Android Studio to use Java 9, we're keeping our target and compile SDK at 28.